home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / ayacc.vim < prev    next >
Encoding:
Text File  |  2001-09-02  |  2.8 KB  |  88 lines

  1. " Vim syntax file
  2. " Language:    AYacc
  3. " Maintainer:    Mathieu Clabaut <mathieu.clabaut@free.fr>
  4. " LastChange:    02 May 2001
  5. " Original:    Yacc, maintained by Dr. Charles E. Campbell, Jr.
  6. "            <Charles.Campbell@gsfc.nasa.gov>
  7. " Comment:         Replaced sourcing c.vim file by ada.vim and rename yacc*
  8. "        in ayacc*
  9.  
  10. " For version 5.x: Clear all syntax items
  11. " For version 6.x: Quit when a syntax file was already loaded
  12. if version < 600
  13.    syntax clear
  14. elseif exists("b:current_syntax")
  15.    finish
  16. endif
  17.  
  18. " Read the Ada syntax to start with
  19. if version < 600
  20.    so <sfile>:p:h/ada.vim
  21. else
  22.    runtime! syntax/ada.vim
  23.    unlet b:current_syntax
  24. endif
  25.  
  26. " Clusters
  27. syn cluster    ayaccActionGroup    contains=ayaccDelim,cInParen,cTodo,cIncluded,ayaccDelim,ayaccCurlyError,ayaccUnionCurly,ayaccUnion,cUserLabel,cOctalZero,cCppOut2,cCppSkip,cErrInBracket,cErrInParen,cOctalError
  28. syn cluster    ayaccUnionGroup    contains=ayaccKey,cComment,ayaccCurly,cType,cStructure,cStorageClass,ayaccUnionCurly
  29.  
  30. " Yacc stuff
  31. syn match    ayaccDelim    "^[ \t]*[:|;]"
  32. syn match    ayaccOper    "@\d\+"
  33.  
  34. syn match    ayaccKey    "^[ \t]*%\(token\|type\|left\|right\|start\|ident\)\>"
  35. syn match    ayaccKey    "[ \t]%\(prec\|expect\|nonassoc\)\>"
  36. syn match    ayaccKey    "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
  37. syn keyword    ayaccKeyActn    yyerrok yyclearin
  38.  
  39. syn match    ayaccUnionStart    "^%union"    skipwhite skipnl nextgroup=ayaccUnion
  40. syn region    ayaccUnion    contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}"    contains=@ayaccUnionGroup
  41. syn region    ayaccUnionCurly    contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
  42. syn match    ayaccBrkt    contained "[<>]"
  43. syn match    ayaccType    "<[a-zA-Z_][a-zA-Z0-9_]*>"    contains=ayaccBrkt
  44. syn match    ayaccDefinition    "^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
  45.  
  46. " special Yacc separators
  47. syn match    ayaccSectionSep    "^[ \t]*%%"
  48. syn match    ayaccSep    "^[ \t]*%{"
  49. syn match    ayaccSep    "^[ \t]*%}"
  50.  
  51. " I'd really like to highlight just the outer {}.  Any suggestions???
  52. syn match    ayaccCurlyError    "[{}]"
  53. syn region    ayaccAction    matchgroup=ayaccCurly start="{" end="}" contains=ALLBUT,@ayaccActionGroup
  54.  
  55. if version >= 508 || !exists("did_ayacc_syntax_inits")
  56.    if version < 508
  57.       let did_ayacc_syntax_inits = 1
  58.       command -nargs=+ HiLink hi link <args>
  59.    else
  60.       command -nargs=+ HiLink hi def link <args>
  61.    endif
  62.  
  63.   " Internal ayacc highlighting links
  64.   HiLink ayaccBrkt    ayaccStmt
  65.   HiLink ayaccKey    ayaccStmt
  66.   HiLink ayaccOper    ayaccStmt
  67.   HiLink ayaccUnionStart    ayaccKey
  68.  
  69.   " External ayacc highlighting links
  70.   HiLink ayaccCurly    Delimiter
  71.   HiLink ayaccCurlyError    Error
  72.   HiLink ayaccDefinition    Function
  73.   HiLink ayaccDelim    Function
  74.   HiLink ayaccKeyActn    Special
  75.   HiLink ayaccSectionSep    Todo
  76.   HiLink ayaccSep    Delimiter
  77.   HiLink ayaccStmt    Statement
  78.   HiLink ayaccType    Type
  79.  
  80.   " since Bram doesn't like my Delimiter :|
  81.   HiLink Delimiter    Type
  82.   delcommand HiLink
  83. endif
  84.  
  85. let b:current_syntax = "ayacc"
  86.  
  87. " vim: ts=15
  88.